package com.beardedcoder.lowPower.app;

import android.util.Log;

public class AppSettings {
	public enum LogLevel {
		debug ("d"), 
		error ("e");
		public final String level;
		LogLevel (String logLevel) { level = logLevel; }
	}
	
	private static boolean logErrors = true;
	
	// don't want to be subclassed and created, ever
	private AppSettings(){}

	public static boolean isLogErrors() {
		return logErrors;
	}
	
	public static void log(Class<?> obj, String method, String message){
		AppSettings.log(obj, method, message, LogLevel.debug);
	}
	
	public static void log(Class<?> obj, String method, String message, LogLevel level){
		if (AppSettings.isLogErrors()) {
			if (level.equals(LogLevel.error)) {
				Log.e(obj.getName(), method + " :: " + message);	
			} else if (level.equals(LogLevel.debug)) {
				Log.d(obj.getName(), method + " :: " + message);	
			} 
		}
	}
}
